package com.wmh.baseservice.admin.controller.mail;

import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;
import com.wmh.baseservice.common.utils.returnbody.ReturnBody;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 谢骏
 * @date 2023/8/30 17:40
 **/
@Api(tags = "管理员-邮件相关接口")
@Validated
@RestController
@RequestMapping("adMail")
public class AdMailController {

    @GetMapping("public/test")
    public String test() {
        MailAccount account = new MailAccount();
        account.setAuth(true)
                .setHost("smtp.163.com")
                .setUser("13432110777@163.com")
                .setPass("QCBHVCYQYOFYEELX")
                .setPort(25)
                .setFrom("13432110777@163.com");
        String html = "  <p>请前往以下链接填写验证码：</p>\n" +
                "    <a href=\"http://119.29.129.235:10001/code\">点击此处填写验证码</a>";
        MailUtil.send(account,"204025156@qq.com","赫巴兹智能办公系统提醒",html,true);
        return ReturnBody.success();
    }
}
